<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.net.*,zdy.web.bean.COOKY" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>获取 Cookie</title>
</head>
<body>

每隔1s 刷新一下网页，观察网页效果
<%
response.setIntHeader("Refresh", 4);

   // 获取cookies的数据,是一个数组 
   Cookie[] cookies= request.getCookies();   
   Cookie cookie=COOKY.getCookieByName(cookies,"name");
 
   if( cookie != null ){
	   out.println("<h2>"+URLDecoder.decode(cookie.getValue(), "utf-8")+"</h2>");
  }else{
      out.println("<h2>没有发现 Cookie</h2>");
  }
%>
<a href="javascript:history.go(-1);"> 返回</a>
</body>
</html>